perm filename HOT[AP,SYS]3 blob sn#015892 filedate 1972-12-17 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	Definitions and storage allocations.
C00004 00003	Main program loop.
C00006 00004	Check to see if a message file exists.  If so, type it out and exit.
C00009 ENDMK
C⊗;
;Definitions and storage allocations.

	TITLE	HOT

A←5				;temporary AC
CNT←6				;timer for trying to contact FILER to request hot line
B←10
C←11
CHAR←12
P←17				;stack pointer

FF←14

PDLEN←10

FILER:	SIXBIT	/[-AP-]/	;addressee of the letter requesting the hot line
	OUTLTR			;address of the 32 word letter to be sent to FILER
OUTLTR:	SIXBIT	/HOT/		;signature of sender of letter
INLTR:	BLOCK	=32		;block for receiving a hot line letter from FILER
	ASCIZ	/
?? oops !!
/			;if whole letter is text, this will terminate the OUTSTR

MESSF:	SIXBIT	/HTMESS/	;file for message to users of HOT when down
	BLOCK	3
TBUF:	BLOCK	3		;buffer header for tty output
MBUF:	BLOCK	3		;buffer header for message file input
PDLIST:	BLOCK	PDLEN
;Main program loop.

HOT1:	RELEAS	17,
	CALLI	A,30		;PJOB
	MOVEM	A,OUTLTR+1	;put job number into letter requesting hot line
	MOVEI	CNT,=30		;this is how many times we try to contact [-AP-]

RQST:	MAIL	5,FILER		;send letter to [-AP-]
	JRST	PAUSE		;can't send letter now; wait and try again
	JRST	SUCCES		;letter successfully sent.  wait for letter from FILER
GIVEUP:	OUTSTR	[ASCIZ /

Cannot run hot line now--sorry.

/]
	CALLI	12		;EXIT

PAUSE:	SOJLE	CNT,GIVEUP	;if have tried unsuccessfully for a long time, give up
	MOVEI	A,1		;sleep a second and then try again
	CALLI	A,31		;SLEEP
	JRST	RQST

SUCCES:	OUTSTR	[ASCIZ /

...Associated Press news...

/]
	JRST	GETLTR

PRINT:	OUTSTR	INLTR		;type out latest letter
GETLTR:	WRCV	INLTR		;get a letter from [-AP-],
	MOVE	A,INLTR		;load first word of letter
	AOJN	A,PRINT		;-1 in first word means FILER is dying, will restart

DYING:	OUTSTR	[ASCIZ /
...one moment please.../]
	MOVEI	A,=20		;this is how long we give FILER to start up again
	CALLI	A,31		;SLEEP
	JRST	HOT
;Check to see if a message file exists.  If so, type it out and exit.

HOT:	MOVE	P,[IOWD PDLEN,PDLIST]
	INIT	17,10		;type out the file HTMESS if it exists
	SIXBIT	/DSK/
	MBUF
	JRST	ERROR	;	;CANT INIT THE DSK
	MOVE	A,[SIXBIT/ APSYS/]
	MOVEM	A,MESSF+3
	LOOKUP	17,MESSF	;is there a message file to be typed out?
	JRST	HOT1		;no
	OUTSTR	[ASCIZ/
/]
	INIT	13,10
	SIXBIT	/TTY/
	XWD	TBUF,0
	JRST	ERROR	;	;CANT INIT THE TTY
	UOUTBF	13,[2↔201]
	PUSHJ	P,GMSWD		;get first word of file
	CAME	A,[ASCII/COMME/];is it a TV file?
	JRST	SOSMES		;no
	PUSHJ	P,PMSWD
	PUSHJ	P,GMSWD
	CAME	A,[ASCII/NT ⊗ /]
	JRST	SOSMES		;not TV file
	GETSTS	13,B
	TRO	B,20		;INHIBIT SYSTEM WORD COUNT
	SETSTS	13,(B)
FINDFF:	PUSHJ	P,GMSRC
	LDB	CHAR,[POINT 7,A,6];get first char of record
	CAIE	CHAR,FF		;FF marks end of TV directory page
	JRST	FINDFF
	TLZ	A,774000	;zero out the FF
	MOVEM	A,@MBUF+1
NXREC:	HRLZ	B,MBUF
	HRR	B,TBUF
	AOBJN	B,.+1
	MOVEI	C,(B)
	BLT	B,200(C)	;move from DSK buffer to TTY buffer
	HRRZS	(C)		;zero out left half of word count word
	OUTPUT	13,		;write out TTY buffer
	PUSHJ	P,GMSRC		;get next record of file
	JRST	NXREC

SOSMES:	TRNN	A,1		;is this word an SOS line number?
	JRST	SOS1		;no
	PUSHJ	P,GMSWD		;yes.  ignore it and get next word from file
	TLZ	A,774000	;zero out the tab following the line number
SOS1:	PUSHJ	P,PMSWD		;write out this word
	PUSHJ	P,GMSWD		;get next word from file
	JRST	SOSMES

PMSWD:	SOSG	TBUF+2		;put word into TTY buffer
	OUTPUT	13,
	IDPB	A,TBUF+1
	POPJ	P,

GMSWD:	SOSG	MBUF+2
GMSRC:	IN	17,		;get next record (buffer) from message file
	JRST	[ILDB A,MBUF+1	;get word from buffer
		 POPJ P,]
	JRST	GIVEUP

ERROR:	OUTSTR	[ASCIZ/
Impossible error occurred.
/]
	CALLI	12

	END	HOT